﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BestCode.Creds.Entities;

namespace BestCode.Creds.Data
{
    public interface IDataAccessBase<T>
    {
        T GetById(object id);
        T Insert(T entity);
        T Save(T entity);
        T Update(T entity);
        void Delete(T entity);
        IList<T> GetAll();
        void Detach(T entity);
    }

    public interface IEntityDao : IDataAccessBase<EntityInfo>
    {
        IList<EntityInfo> GetByFilter(string filter);
    }

    public interface IFieldDefinitionDao : IDataAccessBase<FieldDefinition>
    {
        IList<FieldDefinition> GetByFilter(string filter);

        IList<FieldDefinition> GetByEntityId(int entityId);
    }

    public interface ILayoutDao : IDataAccessBase<Layout>
    {
        IList<Layout> GetByFilter(string filter);
    }

    public interface ITemplateDao : IDataAccessBase<Template>
    {
        IList<Template> GetByFilter(string filter);
        Template GetAnverseFaceByEntity(int entityId);
        Template GetReverseFaceByEntity(int entityId);
    }


    public interface IEntityChildDao : IDataAccessBase<EntityChild>
    {
        IList<EntityChild> GetByFilter(string filter);
        IList<EntityChild> GetByEntityId(int entityId);
    }

    public interface IAttachmentDao : IDataAccessBase<Attachment>
    {
        IList<Attachment> GetByFilter(string filter);
    }
}

